package com.hello.pet.service.system.controller;

import com.hello.pet.common.result.ComResult;
import com.hello.pet.service.system.param.WxLoginParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

@RestController
@Api(tags="认证")
public class AuthController {

    @PostMapping("/login")
    @ApiOperation("账号登录")
    public ComResult login(@RequestBody @Valid UserLongParam userParam){
        return ComResult.success();
    }

    @GetMapping("/logout")
    @ApiOperation("退出登录")
    public ComResult logout(){
        return ComResult.success();
    }

    @PostMapping("/wxLogin")
    @ApiOperation(value = "微信登录")
    public ComResult wxLogin(@RequestBody WxLoginParam wxLoginParam){
        return ComResult.success();
    }

    @Data
    @ApiModel("用户登录参数")
    class UserLongParam{

        @NotNull
        @ApiModelProperty("用户名称")
        private String username;

        @NotNull
        @ApiModelProperty("用户密码")
        private String password;
    }
}
